package han.yang.service.friendship.controller;


import han.yang.common.ResponseVO;
import han.yang.service.friendship.model.req.AddFriendShipGroupMemberReq;
import han.yang.service.friendship.model.req.AddFriendShipGroupReq;
import han.yang.service.friendship.model.req.DeleteFriendShipGroupMemberReq;
import han.yang.service.friendship.model.req.DeleteFriendShipGroupReq;
import han.yang.service.friendship.service.ImFriendShipGroupMemberService;
import han.yang.service.friendship.service.ImFriendShipGroupService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("v1/friendship/group")
public class ImFriendShipGroupController {
    @Resource
    ImFriendShipGroupService imFriendShipGroupService;

    @Resource
    ImFriendShipGroupMemberService imFriendShipGroupMemberService;

    @RequestMapping("/add")
    public ResponseVO<?> add(@RequestBody @Validated AddFriendShipGroupReq req, Integer appId)  {
        req.setAppId(appId);
        return imFriendShipGroupService.addGroup(req);
    }

    @RequestMapping("/del")
    public ResponseVO<?> del(@RequestBody @Validated DeleteFriendShipGroupReq req, Integer appId)  {
        req.setAppId(appId);
        return imFriendShipGroupService.deleteGroup(req);
    }

    @RequestMapping("/member/add")
    public ResponseVO<?> memberAdd(@RequestBody @Validated AddFriendShipGroupMemberReq req, Integer appId)  {
        req.setAppId(appId);
        return imFriendShipGroupMemberService.addGroupMember(req);
    }

    @RequestMapping("/member/del")
    public ResponseVO<?> memberdel(@RequestBody @Validated DeleteFriendShipGroupMemberReq req, Integer appId)  {
        req.setAppId(appId);
        return imFriendShipGroupMemberService.delGroupMember(req);
    }
}
